import request from '@/utils/request'

// 查询纵向课题列表
export function listLongitudinalProjects(query) {
  return request({
    url: '/result/longitudinalProjects/list',
    method: 'get',
    params: query
  })
}

// 查询纵向课题详细
export function getLongitudinalProjects(id) {
  return request({
    url: '/result/longitudinalProjects/' + id,
    method: 'get'
  })
}
/**
 * 根据多个id批量查询纵向课题详细
 */
export function getLongitudinalsByIds(ids) {
  return request({
    url: `/result/longitudinalProjects/getLongitudinalProjectsByIds`,
    method: 'get',
    params: { ids: ids.join(',') } // 将数组转换为逗号分隔的字符串
  });
}
// 新增纵向课题
export function addLongitudinalProjects(data) {
  return request({
    url: '/result/longitudinalProjects',
    method: 'post',
    data: data
  })
}

// 修改纵向课题
export function updateLongitudinalProjects(data) {
  return request({
    url: '/result/longitudinalProjects',
    method: 'put',
    data: data
  })
}

// 删除纵向课题
export function delLongitudinalProjects(id) {
  return request({
    url: '/result/longitudinalProjects/' + id,
    method: 'delete'
  })
}
/**
 * 批量导出纵向课题
 */
export function exportLongitudinalProjects(params) {
  return request.post(`/result/longitudinalProjects/export/longitudinalProjects`, params, {
    responseType: 'blob'
  });
}
// 根据ID查询课题名
export function getProjectNameById(id) {
  return request({
    url: `/result/longitudinalProjects/getProjectNameById/${id}`,
    method: 'get'
  })
}
